package gameEntities;

import javax.microedition.lcdui.game.Sprite;
import math.*;

/**
 * The abstract Class MovingGameEntity defines how moving game entities
 * should look like.
 */
public abstract class MovingGameEntity extends GameEntity {
	
	/**
	 * Instantiates a new moving game entity.
	 *
	 * @param sprite the sprite
	 * @param position the position
	 */
	public MovingGameEntity(Sprite sprite, Vector2D position) {
		super(sprite, position);
		
		velocity = new Vector2D();
	}
	
	/* (non-Javadoc)
	 * @see gameEntities.GameEntity#Update(float)
	 */
	public void Update(float deltaTime)
	{
		position.x += velocity.x * deltaTime;
		position.y += velocity.y * deltaTime;
		
		sprite.setPosition((int)position.x, (int)position.y);
	}
	
	/** The velocity of the game entity. */
	public Vector2D velocity;
}
